<?php

namespace App\Console\Commands;

use App\Http\Controllers\Front\Industry;
use Illuminate\Console\Command;

class SysCronJob extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'sys:cron';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle(Industry $industry)
    {
        // $industry = new Industry();
        $solutionResult = $industry->cacheSolutionData();
        $message1 = $solutionResult['result1'] ? "解决方案领域1缓存--成功" : "解决方案领域1缓存--失败";
        cronLog($message1);
        $message2 = $solutionResult['result2'] ? "解决方案领域2缓存--成功" : "解决方案领域2缓存--失败";
        cronLog($message2);
        $chainResult = $industry->cacheChainData();
        $message3 = $chainResult['result1'] ? "供应链领域1缓存--成功" : "供应链领域1缓存--失败";
        cronLog($message3);
        $message4 = $chainResult['result2'] ? "供应链领域2缓存--成功" : "供应链领域2缓存--失败";
        cronLog($message4);
        $greenResult = $industry->cacheGreenResultData();
        $message5 = $greenResult['result'] ? "绿色成果缓存--成功\r\n" : "绿色成果缓存--失败\r\n";
        cronLog($message5);
    }
}
